<?php

namespace iBrand\AlbumBackend\Console;

use iBrand\AlbumBackend\Models\ImageCategory;
use Illuminate\Console\Command;

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/10/4
 * Time: 22:16
 */
class ImageCategoryCommand extends Command
{

	protected $signature = 'image-category';

	protected $description = 'create image default category.';

	/**
	 * Execute the console command.
	 *
	 * @return mixed
	 */
	public function handle()
	{
		if (!ImageCategory::where('name', '默认分组')->first()) {
			ImageCategory::create(['parent_id' => 0, 'name' => '默认分组', 'sort' => 0]);
		}
	}

}